$(function() {
	$("#left").load("../common/gover-left.html");
	var type = isEmpty(parseQueryString().type) ? 'dept' : parseQueryString().type;
	$(".ystep1").loadStep({
		size: "small",
		color: "green",
		steps: [{
				title: "事项选择"
			},
			{
				title: "服务选择"
			},
			{
				title: "信息录入"
			},
			{
				title: "寄件选择"
			},
			{
				title: "取件选择"
			},
			{
				title: "提交成功"
			}
		]
	});
	$(".ystep1").setStep(1);
	//				$("#tab_demo").tuitab({
	//					"bar": ".yl-tabBar .item",
	//					"content": ".yl-tabCon",
	//					"className": "current"
	//				});
	$(".yl-tabBar.yl-tabBar2>.item").click(function() {
		var index_tab = $(this).index();
		$(this).addClass("current").siblings().removeClass("current");
		$(".yl-tab .choose-block-box").eq(index_tab).removeClass("dis_no").siblings(".yl-tab .choose-block-box").addClass("dis_no")
	})

	my_vue = new Vue({
		el: '#vue_info',
		data: {
			type: "",
			grList: [],
			qyList: [],
			deptList: []
		},
		methods: {
			exitProcess: function(op) {
				if(op == 'index') {
					$.showConfirm({
						'title': '',
						'content': '是否退出办理？',
						"showClose": false,
						"sureLabel": "取消",
						"cancelLabel": "退出办理",
						'cancel': this.toIndex
					});
				} else if(op == 'scanner') {
					$.showConfirm({
						'title': '',
						'content': '是否退出办理？',
						"showClose": false,
						"sureLabel": "取消",
						"cancelLabel": "退出办理",
						'cancel': this.toScanner
					});
				}
			},
			toIndex: function() {
				window.location = "index.html"
			},
			toScanner: function() {
				window.location = "scannerIndex.html"
			},
			link: function(businessId, type) {
				sessionStorage.setItem("SxType", type);
				window.location = "selfHelpBusinessChooseList.html?businessId=" + businessId + "&type=" + type;
			},
			exitAttendTo: function() {
				$.openDialog({
					'title': '',
					"showClose": false,
					'width': 824,
					'height': 460,
					'url': 'selfHelpExitChoose.html'
				});
			},
			changeTab: function() {
				//							$(".yl-tabBar.yl-tabBar2>.item").click(function() {
				//								var index_tab = $(".yl-tabBar.yl-tabBar2>.item").index();
				//								alert(index_tab)
				//							})
			},
			getBusList: function() {
				this.$http.get(gover.getBusList, {

				}).then(function(result) {
					console.log(toJson(result.data.data.grList))
					doMask();
						if(result.data.success) {
							unMask();
							this.grList = result.data.data.grList;
							this.qyList = result.data.data.qyList;
							this.deptList = result.data.data.deptList;							
						}else{
							unMask();
							setTimeout("showRedMsg('','暂无事项!');", 1400);
						}

				}, function() {
					unMask();
					console.log('保存接口失败:' + toJson(result));
					top.$.closePopWin();

				})
			},
		},
		ready: function() {
			//初始化获得总页面数和列表数据
			this.getBusList();
			if(type == 'gr') {
				$(".yl-tabBar.yl-tabBar2>.item").eq(1).addClass("current").siblings().removeClass("current");
				$(".yl-tab .choose-block-box").eq(1).removeClass("dis_no").siblings(".yl-tab .choose-block-box").addClass("dis_no")
			} else if(type == 'fr') {
				$(".yl-tabBar.yl-tabBar2>.item").eq(2).addClass("current").siblings().removeClass("current");
				$(".yl-tab .choose-block-box").eq(3).removeClass("dis_no").siblings(".yl-tab .choose-block-box").addClass("dis_no")
			} else {
				$(".yl-tabBar.yl-tabBar2>.item").eq(0).addClass("current").siblings().removeClass("current");
				$(".yl-tab .choose-block-box").eq(0).removeClass("dis_no").siblings(".yl-tab .choose-block-box").addClass("dis_no")
			}
			$("#"+type).click();

		}
	});
});